package java8.stream;

import org.junit.Before;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;

public class FunctionDemo {

    static Map<String , Function<String,String>> map = new HashMap<>();
    public static void main(String[] args) {
        new FunctionDemo().testFunction();
        Function<String, String> function = map.getOrDefault("wen", s -> "Unknown");
        String apply = function.apply("温腾飞");
        System.out.println(apply);


    }


    public void testFunction(){
        System.out.println("wo执行了");

        map.put("wen",this::sayHello);

    }


    public String sayHello(String str){
        return "hello" + str;
    }

    public FunctionDemo() {
        System.out.println("我是构造方法");
    }
}
